<%@ page language="java" contentType="text/html; charset=UTF-8"
         import="java.util.*" pageEncoding="UTF-8" %>
<%@page language="java" import="db_tool.DBConnection" %>
<%@page language="java" import="java.sql.ResultSet" %>
<%@page language="java" import="java.sql.Statement" %>

<%@page language="java" import="com.opensymphony.xwork2.ActionContext" %>
<%
    String email = (String) session.getAttribute("email");
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="edge"/>
    <meta name="author" content="Daliu"/>
    <meta name="keywords" content="长江上游珍稀特有鱼类保护信息管理系统、长江上游、珍稀特有鱼类、保护信息"/>
    <meta name="describe" content="长江上游珍稀特有鱼类保护信息管理系统"/>
    <title>长江上游珍稀特有鱼类保护信息管理系统</title>
    <link rel="icon" href="<%=path%>/bfish.ico"
          mce_href="<%=path%>/bfish.ico" type="image/x-icon">
    <link rel="shortcut icon" href="<%=path%>/bfish.ico"
          mce_href="<%=path%>/bfish.ico" type="image/x-icon">
    <link type="text/css" href="css/partI.css" rel="stylesheet"/>
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
    <!-- 表单验证 -->
    <script type="text/javascript" src="js/jquery-1.12.3.min.js"></script>
    <script type="text/javascript" src="js/jquery.validate.min.js"></script>

</head>
<body>
<div class="content">
    <div class="web-width">
        <div class="for-process">
            <div class="plist for-cur"></div>
            <div class="plist for-cur"></div>
            <div class="plist for-cur"></div>
            <div class="plist"></div>
            <div class="ptextbox">
                <div class="ptext for-cur"><em>1</em><br/><strong>填写账户名</strong></div>
                <div class="ptext for-cur"><em>2</em><br/><strong>验证身份</strong></div>
                <div class="ptext for-cur"><em>3</em><br/><strong>设置新密码</strong></div>
                <div class="ptext"><em>4</em><br/><strong>完成</strong></div>
            </div>
        </div><!--for-liucheng/-->
        <form class="forget-pwd">
            <dl>
                <dt>新密码：</dt>
                <dd><input type="password" id="newPassword"/></dd>
                <div class="clears"></div>
            </dl>
            <dl>
                <dt>确认密码：</dt>
                <dd><input type="password" id="confirm"/></dd>
                <div class="clears"></div>
            </dl>
            <div class="submit"><input id="submit" type="submit" value="提交"/></div>
        </form><!--forget-pwd/-->
        <script type="text/javascript">
            $().ready(function () {
                $("#submit").click(function () {
                    var email = "<%= email%>";
                    var newPassword = $("#newPassword").val();
                    var confirm = $("#confirm").val();
                    if (newPassword == confirm) {
                        $.ajax({
                            url: "changePassword.action",
                            type: "POST",
                            data: {
                                "Email": email,
                                "password": newPassword,
                            },
                            async: false,
                            success: function (result) {
                                if (result == "true") {
                                    window.location.href = "findPasswordPartIV.jsp";
                                    window.event.returnValue = false;
                                }  else {
                                    alert("密码修改失败,请检查网络连接");
                                }
                            }
                        });
                    } else {
                        alert("两次输入不一致");
                    }
                })
            })
        </script>
    </div><!--web-width/-->
</div><!--content/-->

</body>
</html>